import { PageReq, PageRes } from '@/api/types'
import request from '@/utils/request'
import { {{ bigName }}Model } from '@/api/model/{{ fileName }}-model'

// 获取{{ cname }}列表
export function {{ smallName }}PageApi(data: PageReq<Partial<{{ bigName }}Model>>) {
  return request<PageRes<{{ bigName }}Model>>({
    url: 'API_PREFIX/page',
    method: 'post',
    data
  })
}

// 新增{{ cname }}
export function add{{ bigName }}Api(data: Partial<{{ bigName }}Model>) {
  return request({
    url: 'API_PREFIX/add',
    method: 'post',
    data
  })
}

// 更新{{ cname }}
export function edit{{ bigName }}Api(
  data: Partial<{{ bigName }}Model & { id: number }>
) {
  return request({
    url: 'API_PREFIX/edit',
    method: 'post',
    data
  })
}

// 删除{{ cname }}
export function del{{ bigName }}Api(data: { id: number }) {
  return request({
    url: 'API_PREFIX/del',
    method: 'post',
    data
  })
}
